home *** CD-ROM | disk | FTP | other *** search
Wrap
' ' ' WIN7PLUS -=- (c) Charlie McIver 1996 ' Purple Computer Solutions ' ' Requires use of 7PLUS.DLL, also by me! ' ' Declare Function Seven_Plus_Encode Lib "7plus.dll" (ByVal Filename As String, ByVal blocksize As Long, ByVal first_part As Integer, ByVal last_part As Integer, ByVal info As Integer, ByVal crmode As Integer) As Integer Declare Function seven_plus_process Lib "7plus.dll" (ByVal Filename As String, ByVal Path As String, ByVal Cleanup As Integer, ByVal override As Integer) As Integer Declare Function Seven_Plus_Version Lib "7plus.dll" () As Integer Declare Function seven_plus_extract Lib "7plus.dll" (ByVal Filename As String) As Integer Declare Function Seven_Plus_Do Lib "7plus.dll" (ByVal Arg As String, ByVal nStrLen As Integer) As Integer Global strError(19) As String Global strErrorHeader As String Global strDataPath As String 'Rewrites a default INI file 'Its done in a naughty way - we should use the real windows INI functions! Sub CreateNewINI () Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "FilePath", Format$(App.Path)) Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Cleanup", "1") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "ErrorHeader", "7+ reported an error: ") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error0", "No Error detected") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error1", "Write Error") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error2", "File not found") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error3", "7+ header not found") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error4", "File does not contain expected part") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error5", "7 + header Is corrupt") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error6", "No filename for extracting is defined") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error7", "invalid error report / correction / index file") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error8", "Max number of parts exceeded") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error9", "Bit 8 stripped") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error10", "User break in test_file()") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error11", "Error report generated") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error12", "Only one, or no error report to join") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error13", "Error report / cor file does not refer to the same original file") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error14", "Couldn't write 7PLUS.FLS") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error15", "Filesize of original file and the size reported in err/cor file not equal") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error16", "Correction not successful") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error17", "No CRC found in err / cor file") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error18", "Time stamp in metafile differs from that in the COR file") Call INI_Set(App.Path + "\WIN7PLUS.INI", "Win7PLUS", "Error19", "Metafile already exists") Close #l End Sub Sub Main () Dim INIFIle As String: INIFIle = App.Path + "\WIN7PLUS.INI" 'If the ini file does not exist, create it! If File_Exist(App.Path + "\WIN7PLUS.INI") = False Then Call CreateNewINI strDataPath = ini_get(App.Path + "\WIN7PLUS.INI", "SevenPlus", "FilePath") 'Load all the error message (they might be in french! - if anyone will translate!)# strErrorHeader = ini_get(INIFIle, "SevenPlus", "ErrorHeader") For j = 0 To 19 strError(j) = ini_get(INIFIle, "SevenPlus", "Error" + Format(j)) Next j 'IF no Command Line Parameters are given, go on, else behave like normal 7+ If Command = "" Then 'Show the main window frmMain.Show 'Set the Cleanup box and load the data path If ini_get_int(INIFIle, "SevenPlus", "Cleanup") Then frmMain.chkCleanup.Value = 1 Else 'Behave exactly like normal old 7+ for DOS 'All I do is simply pass a sting to the DLL function Seven_Plus_Do Dim CLParams As String, temp As String CLParams = Command + Chr(0) 'Change directory? If InStr(UCase(Command), "-D") > 0 Then ChDrive (strDataPath) ChDir (strDataPath) End If 'Run 7+ and report any error f = Seven_Plus_Do(CLParams, Len(CLParams)) If f <> 0 Then MsgBox strErrorHeader + Chr(10) + strError(f) 'Terminate End End If End Sub Sub SplitSpacedText (strLine, strField(), nFields) n = 0 Do a = InStr(strLine, " ") 'If a the first char is a space this will cause an error (it could be double spaced)! Select Case a Case 0 strLine = "" strField(n) = strLine Case 1 strLine = Mid(strLine, 2) Case Else strField(n) = Left(strLine, a - 1) strLine = Mid(strLine, a + 1) n = n + 1 ReDim Preserve strField(n) End Select Loop Until a = 0 nFields = n End Sub Sub Status (Status_Text As String) frmMain.pnlStatus = Status_Text frmMain.Timer.Interval = 1500 End Sub